package com.ruoyi.logistic.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.domain.vo.TableVo;
import com.ruoyi.common.service.TableService;
import com.ruoyi.logistic.domain.NetworkTransferMoney;
import com.ruoyi.logistic.domain.PageDate;
import com.ruoyi.logistic.domain.PageInfo;
import com.ruoyi.logistic.domain.vo.NetworkTransferMoneyVo;
import com.ruoyi.logistic.service.INetworkTransferMoneyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/network/transferMoney")
@RestController
@Api(tags = "网点财务_出港发件费结算_承包区中转费汇总")
public class NetworkTransferMoneyController {
    @Autowired
    private INetworkTransferMoneyService networkTransferMoneyService;
    @Autowired
    private TableService tableService;

    @ApiOperation("搜索承包区中转费汇总列表")
    @PostMapping("/search")
    public R search(@RequestBody NetworkTransferMoneyVo networkTransferMoneyVo){
        List<NetworkTransferMoney> networkTransferMonies = networkTransferMoneyService.search(networkTransferMoneyVo);
        List<TableVo> fieldList = tableService.getFieldAnnotation(new NetworkTransferMoney());
        com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
        jsonObject.put("list", PageInfo.info(networkTransferMonies));
        jsonObject.put("fields", fieldList);
        if (networkTransferMonies == null || networkTransferMonies.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(jsonObject);
        }
    }
}
